<script src="<?= base_url(); ?>third_party/ckeditor/ckeditor.js"></script>
<style>
#map1 {
  height: 300px;
  border: 1px solid #000;
}
#map {
  height: 300px;
  border: 1px solid #000;
}
.widt{
  width:200px;
}
.col-lg-3 {
width: 23%;
}
</style>
<div class="module clearfix">
<?php if($mode == "SALE"){?>

	<div>

		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">
					<span class="glyphicon glyphicon-random"></span> &nbsp;Sale your
					Business ?
				</h3>
			</div>




			<div class="panel-body">

				<div class="col-xs-12 clearfix">
					<p class="text-muted small">Want to sale your Business?</p>
					<?php if($this->session->flashdata('message')) { 
						$show_message = $this->session->flashdata('message'); ?>
				<div class='alert alert-warning'><?= $show_message; ?> </div>
				<?php } ?>
					<form class="well well-small" method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/add/">

						<div class="row">
							<div class="form-group col-xs-12">
								<label>Sale Title <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('sale_title'); ?>
								</span> <input type="text" name="sale_title" id="sale_title" class="form-control"
									placeholder="Title of your Sale Ad" value="<?php echo set_value('sale_title');?>">
							</div>
						</div>

						<div class="row">
							<div class="form-group col-xs-12" onClick="getlatlong()">
								<label>Address <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('sale_address'); ?>
								</span> <input type="text" name="sale_address" id="street_address1" class="form-control"
									 placeholder="Title of your Sale Address" value="<?php echo set_value('sale_address');?>">
							</div>
						</div>

						<div class="row">
							<div id="statediv" class="form-group col-xs-6" onClick="getlatlong()">
								<label>Province / State <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('state'); ?>
								</span> <select class="form-control" name="state" id="state">
									<option value="" selected="selected">--State--</option>
									<?php if($state['all']){?>
									<?php foreach($state['all'] as $state):?>
									<option value="<?= $state->id;?>"><?= $state->statename;?></option>
									<?php endforeach;}?>
								</select>
							</div>

							<div id="citydiv" class="form-group col-xs-6" onClick="getlatlong()">
								<label>City <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('city'); ?>
								</span> <select class="form-control" name="city" id="city">
									<option value="" selected="selected">--City--</option>
								</select>
							</div>
						</div>

						<div class="row">
							<div class="form-group col-xs-12">
								<label>Location Map<span class="text text-danger"> Drag mouse
										pointer and make exact location</span>
								</label>
							</div>
						</div>

						<div class="row">
						<div class="form-group col-xs-12" style="display: none" id="mymap">
									<label>Select Place</label>
									<div class="controls">
										<div id="map"></div>
									</div>
								</div>
								</div>	
									
									<div class="row" hidden>
							<div class="form-group  col-xs-6">
								<label>Latitude </label> <input type="text" name="lat" id="lat" class="form-control"
									placeholder="Latitude" 
									>
							</div>
							<div class="form-group  col-xs-6">
								<label>Longitude</label> <input type="text" name="long" id="long" class="form-control"
									placeholder="Longitude">
							</div>
						</div>

						<div class="row">
							<div class="form-group col-xs-6">
								<label>Contact Person <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('contact_person'); ?>
								</span> <input type="text" name="contact_person" id="contact_person" class="form-control"
									 placeholder="Contact Person" value="<?php echo set_value('contact_person');?>">
							</div>

							<div class="form-group col-xs-6">
								<label>Contact No <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('contact_no'); ?>
								</span> <input type="text" name="contact_no" id="contact_no" class="form-control"
									value="" placeholder="Contact No" value="<?php echo set_value('contact_no');?>">
							</div>
						</div>

						<div class="row">
							<div class="form-group col-xs-6">
								<label>Sale Price <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('sale_price'); ?>
								</span>

								<div class="input-group">
									<span class="input-group-addon">$</span> <input type="text"
										class="form-control" name="sale_price" id="sale_price" placeholder="Price" value="<?php echo set_value('sale_price');?>">
								</div>

							</div>

							<div class="form-group col-xs-3">
								<label>Price Type <span class="text text-danger">*</span>
								</label>
								<span class="text text-danger"> <?php echo form_error('"price_type"'); ?>
								</span>
								 <select class="form-control" name="price_type">
									<option value="fixed" selected="selected">Fixed</option>
									<option value="negotiable">Negotiable</option>
								</select>

							</div>

						</div>

						<div class="row">
							<div class="form-group col-xs-12">
								<label>Description <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('sale_description'); ?>
								</span>

								<textarea class="form-group" cols="5" rows="4"
									style="height: auto;" name="sale_description">
									
									</textarea>
								<script type="text/javascript">
                                //<![CDATA[
                                CKEDITOR.replace( 'sale_description',
                                {
                                    skin : 'v2',
                                    enterMode : CKEDITOR.ENTER_DIV,
                                    toolbar :
                                        [
                                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                        [ 'UIColor' ]
                                    ]
                                });
                                //]]>
                            </script>
							</div>




						</div>

						<div class="row">
							<div class="form-group col-xs-6">

								<input type="file" name="userfile1" data-filename-placement="inside">
							</div>
							 <div class="form-group col-xs-6">
								<input type="file" name="userfile2" data-filename-placement="inside">
							</div> 
							
						</div>
						<div class="row">
							<div class="form-group col-xs-6">
								<input type="file" name="userfile3" data-filename-placement="inside">
							</div>
							 <div class="form-group col-xs-6">
								<input type="file" name="userfile4" data-filename-placement="inside">
							</div> 
							
						</div>
						<div class="row">
							<div class="form-group col-xs-6">

								<input type="file" name="userfile5" data-filename-placement="inside">
							</div>
							 <div class="form-group col-xs-6">
								<input type="file" name="userfile6" data-filename-placement="inside">
							</div> 
							
						</div>

						<div class="row">
							<div class="form-group col-xs-2 clearfix">
								<button type="submit" name="upload" class="form-group btn btn-success">Post
									Ads</button>
							</div>
						</div>

					</form>

				</div>

			</div>

		</div>


	</div>
<?php }?>

<?php if($mode == "EDIT"){?>

	<div>

		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">
					<span class="glyphicon glyphicon-random"></span> &nbsp;Edit 
					Business : <?= $sale['info']->title;?>
				</h3>
			</div>




			<div class="panel-body">

				<div class="col-xs-12 clearfix">
					<p class="text-muted small">Want to Update your Business?</p>
<?php if($this->session->flashdata('message')) { 
						$show_message = $this->session->flashdata('message'); ?>
				<div class='alert alert-warning'><?= $show_message; ?> </div>
				<?php } ?>


					<form class="well well-small" method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/update">

						<div class="row">
							<div class="form-group col-xs-12">
								<label>Sale Title <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span> <input type="text" name="sale_title" id="sale_title" class="form-control"
									placeholder="Title of your Sale Ad" value="<?= $sale['info']->title;?>">
							</div>
						</div>

						

						<div class="row">
							<div id="statediv" class="form-group col-xs-6" onClick="getlattlong()">
								<label>Province / State <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span> <select class="form-control" name="state" id="state">
									<option value="" selected="selected">-Select-</option>
										<?php foreach($state['all'] as $state):?>
										<option value="<?= $state->id;?>"
									<?php if($state->id == $sale['info']->state){echo "selected=selected";}?>>
										<?= $state->statename;?></option>
									<?php endforeach;?>
								</select>
							</div>

							<div id="citydiv" class="form-group col-xs-6" onClick="getlattlong()">
								<label>City <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span> <select class="form-control" name="city" id="city">
									<option value="" selected="selected">-Select-</option>
									<?php foreach($city as $city):?>
									<option value="<?= $city->id;?>"<?php if($city->id == $sale['info']->city){echo "selected=selected";}?>" >
										<?= $city->cityname;?></option>
								<?php endforeach;?>
								</select>
							</div>
						</div>
<div class="row">
							<div class="form-group col-xs-12" onClick="getlattlong()">
								<label>Address <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span> <input type="text" name="sale_address" id="street_address1" class="form-control"
									 placeholder="Title of your Sale Address" value="<?= $sale['info']->address;?>">
							</div>
						</div>
						<div class="row">
							<div class="form-group col-xs-12">
								<label>Location Map<span class="text text-danger"> Drag mouse
										pointer and make exact location</span>
								</label>
							</div>
						</div>

						<div class="row">
						<div class="form-group col-xs-12" id="mymap1">
									<label>Select Place</label>
									<div class="controls">
										<div id="map1"></div>
									</div>
								</div>
								</div>	
									
									<div class="row" hidden="hidden">
									
							<div class="form-group  col-xs-6">
								<label>Latitude </label> <input type="text" name="lat" id="lat" class="form-control"
									placeholder="Latitude" value="<?= $sale['info']->lat;?>"
									>
							</div>
							<div class="form-group  col-xs-6">
								<label>Longitude</label> <input type="text" name="long" id="long" class="form-control"
									placeholder="Longitude" value="<?= $sale['info']->long;?>">
							</div>
						</div>

						<div class="row">
							<div class="form-group col-xs-6">
								<label>Contact Person <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span> <input type="text" name="contact_person" id="contact_person" class="form-control"
									 placeholder="Contact Person" value="<?= $sale['info']->contact_person;?>">
							</div>

							<div class="form-group col-xs-6">
								<label>Contact No <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span> <input type="text" name="contact_no" id="contact_no" class="form-control"
									placeholder="Contact No" value="<?= $sale['info']->contact_no;?>">
							</div>
						</div>

						<div class="row">
							<div class="form-group col-xs-6">
								<label>Sale Price <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span>

								<div class="input-group">
									<span class="input-group-addon">$</span> <input type="text"
										class="form-control" name="sale_price" id="sale_price" placeholder="Price" value="<?= $sale['info']->price;?>">
								</div>

							</div>

							<div class="form-group col-xs-3">
								<label>Check price Type <span class="text text-danger">*</span>
								</label> <select class="form-control" name="price_type">
								<option value="" selected="selected">-Select Price Type-</option>
									<option value="fixed" <?php if($sale['info']->price_type == "fixed"){  echo "selected=selected";}?>>Fixed</option>
									<option value="negotiable" <?php if($sale['info']->price_type == "negotiable"){  echo "selected=selected";}?>>Negotiable</option>
								</select>

							</div>

						</div>

						<div class="row">
							<div class="form-group col-xs-12">
								<label>Description <span class="text text-danger">*</span>
								</label> <span class="text text-danger"> <?php echo form_error('title'); ?>
								</span>

<textarea class="form-group" cols="5" rows="4"style="height: auto;" name="sale_description"><?= $sale['info']->description;?></textarea>
								<script type="text/javascript">
                                //<![CDATA[
                                CKEDITOR.replace( 'sale_description',
                                {
                                    skin : 'v2',
                                    enterMode : CKEDITOR.ENTER_DIV,
                                    toolbar :
                                        [
                                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                        [ 'UIColor' ]
                                    ]
                                });
                                //]]>
                            </script>
							</div>




						</div>
						<div class="row">
							<div class="form-group col-xs-2 clearfix">
							
							<input type="hidden" name="sale_id" value="<?= $sale['info']->id;?>">
								<button type="submit" name="upload" class="form-group btn btn-success">Update
									Ads</button>
							</div>
						</div>

					</form>
					
					
				
					
<?php if($this->session->flashdata('msz')) { 
						$show_message = $this->session->flashdata('msz'); ?>
				<div class='alert alert-warning'><?= $show_message; ?> </div>
				<?php } ?>
				
					
    <div class="container">
        <div class="row">
            <div class="col-lg-3 col-md-4 col-xs-6 thumb">
             <div class="thumbnail widt">
             <form  method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/image1">
                <a href="#">
                    <img class="img-responsive" src="<?= base_url();?>assets/images/sale/<?= $sale['info']->image1;?>">
                </a>
               <input type="hidden" name="sale_id" value="<?= $sale['info']->id;?>">
                <input type="file" name="userfile" data-filename-placement="inside" >
						<button class="btn btn-success btn-xs">
											Change
										</button>
										<a class="btn btn-danger btn-xs" href="<?= base_url();?>member/sale/delete1/<?= $sale['info']->id;?>/<?= $sale['info']->image1;?>">
										Delete
						</a>
                </form>
            </div></div>
            <div class="col-lg-3 col-md-4 col-xs-6 thumb">
             <div class="thumbnail widt">
             <form  method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/image2">
                <a  href="#">
                    <img class="img-responsive" src="<?= base_url();?>assets/images/sale/<?= $sale['info']->image2;?>">
                </a>
                <input type="hidden" name="sale_id" value="<?= $sale['info']->id;?>">
                 <input type="file" name="userfile" data-filename-placement="inside" >
						<button class="btn btn-success btn-xs">
											Change2
										</button>
										<a class="btn btn-danger btn-xs" href="<?= base_url();?>member/sale/delete2/<?= $sale['info']->id;?>/<?= $sale['info']->image2;?>">
										Delete
						</a>
                </form>
            </div>
            </div>
            <div class="col-lg-3 col-md-4 col-xs-6 thumb">
             <div class="thumbnail widt">
             <form  method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/image3">
                <a  href="#">
                    <img class="img-responsive" src="<?= base_url();?>assets/images/sale/<?= $sale['info']->image3;?>">
                </a>
                <input type="hidden" name="sale_id" value="<?= $sale['info']->id;?>">
                 <input type="file" name="userfile" data-filename-placement="inside" >
						<button class="btn btn-success btn-xs">
											Change
										</button>
										<a class="btn btn-danger btn-xs" href="<?= base_url();?>member/sale/delete3/<?= $sale['info']->id;?>/<?= $sale['info']->image3;?>">
										Delete
						</a>
                </form>
            </div>
            </div>
           
        </div>
       
        <div class="row">
        
        <div class="col-lg-3 col-md-4 col-xs-6 thumb">
             <div class="thumbnail widt">
             <form  method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/image4">
                <a  href="#">
                    <img class="img-responsive" src="<?= base_url();?>assets/images/sale/<?= $sale['info']->image4;?>">
                </a>
                <input type="hidden" name="sale_id" value="<?= $sale['info']->id;?>">
                 <input type="file" name="userfile" data-filename-placement="inside" >
						<button class="btn btn-success btn-xs">
											Change
										</button>
										<a class="btn btn-danger btn-xs" href="<?= base_url();?>member/sale/delete4/<?= $sale['info']->id;?>/<?= $sale['info']->image4;?>">
										Delete
						</a>
                </form>
            </div>
            </div>
        <div class="col-lg-3 col-md-4 col-xs-6 thumb">
             <div class="thumbnail widt">
             <form  method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/image5">
                <a  href="#">
                    <img class="img-responsive" src="<?= base_url();?>assets/images/sale/<?= $sale['info']->image5;?>">
                </a>
                <input type="hidden" name="sale_id" value="<?= $sale['info']->id;?>">
                 <input type="file" name="userfile" data-filename-placement="inside" >
						<button class="btn btn-success btn-xs">
											Change
										</button>
										<a class="btn btn-danger btn-xs" href="<?= base_url();?>member/sale/delete5/<?= $sale['info']->id;?>/<?= $sale['info']->image3;?>">
										Delete
						</a>
                </form>
            </div>
            </div>
            
            <div class="col-lg-3 col-md-4 col-xs-6 thumb">
             <div class="thumbnail widt">
             <form  method="POST" enctype="multipart/form-data"
						action="<?= base_url();?>member/sale/image6">
                
                    <img class="img-responsive" src="<?= base_url();?>assets/images/sale/<?= $sale['info']->image6;?>">
                <input type="hidden" name="sale_id" value="<?= $sale['info']->id;?>">
                 <input type="file" name="userfile" data-filename-placement="inside" >
						<button class="btn btn-success btn-xs">
											Change
										</button>
										<a class="btn btn-danger btn-xs" href="<?= base_url();?>member/sale/delete6/<?= $sale['info']->id;?>/<?= $sale['info']->image4;?>">
										Delete
						</a>
                </form>
            </div>
            </div>
            </div>
		</div>			
				
				</div>

			</div>

		</div>


	</div>

<?php }?>




	<?php 
	if($mode=="VIEW"){
		?>

	<div>

		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">
					<span class="glyphicon glyphicon-random"></span> &nbsp;Message
					Maintanence
					<div class="badge pull-right">
						<a class="text text-success"
							href="<?= base_url();?>member/message">BACK</a>
					</div>
				</h3>

			</div>
			<div class="panel-body">

				<div class="col-xs-12 clearfix">

					<form class="form-horizontal" role="form" method="post" action="#">
						<div class="form-group">
							<label class="col-sm-3 control-label">Comment</label>
							<div class="col-sm-9">
								<textarea class="form-control" cols="5" rows="4"
									style="height: auto;" name="article_description">
									<?= $message['info']->comment;?>
									</textarea>
								<script type="text/javascript">
                                //<![CDATA[
                                CKEDITOR.replace( 'article_description',
                                {
                                    skin : 'v2',
                                    enterMode : CKEDITOR.ENTER_DIV,
                                    toolbar :
                                        [
                                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                        [ 'UIColor' ]
                                    ]
                                });
                                //]]>
                            </script>
							</div>
						</div>


						<hr>


					</form>
				</div>

			</div>
		</div>
	</div>

	<?php }?>

</div>



<?php if($mode == "DETAIL"){?>





<div class="module clearfix border-bottom">
	<h1>
		Title
		- <small>City
			State
		</small>
	</h1>
</div>




<div class="panel panel-default featured  margin-bottom">
	<div class="row ">
		<div class="panel-body">
			
			
						<div class="col-lg-9">


				<h1 class="title-text text-danger">
					Title
					- <small>City,
						Satte
					</small>
				</h1>
				<p class=" small">Description</p>

				<p>
					<botton class="btn btn-sm btn-danger" data-toggle="modal"
						data-target="#myModal">Send Enquiry</botton>
					<!-- <botton class="btn btn-sm btn-default">Send to a friend</botton> -->

				
				</p>

			</div>

		</div>
	</div>
</div>

<div class="panel panel-default margin-top">
	<div class="panel-body">
		<h2 class="title-text">
			Speciality of Mr.
			<?= ucfirst(strtolower($profile['details']->title));?>
			</h4>
			<div class="col-xs-12">
				<ul class="list-unstyled">
					<?php if($term['all']){?>
					<?php foreach($term['all'] as $term):?>
					<li class="col-xs-6"><a
						href="<?= base_url()."browse/practice/".$this->commoncall->url($this->listing_model->getCategory($term->term_value)->name)."-".$term->term_value; ?>"
						class="text-info"><?= $this->listing_model->getCategory($term->term_value)->name; ?>
					</a> <?php endforeach;
			}?> 
				
				</ul>
			</div>
	
	</div>
</div>

<div class="margin-bottom">
	<h2 class="title-text strong border-bottom">
		Overview of Mr.
		Ttle
	</h2>
	<div class="clearfix margin-bottom border-bottom">
		<div class="col-xs-3 strong text-muted">CONTACT INFORMATION</div>

		<div class="col-xs-9">
			<address>
				<strong> <?php if($profile['details']->address1){?> <?= $profile['details']->address1;?>
					<?php }?>, <?php if($profile['details']->address2){?> <?= $profile['details']->address2;?>
					<?php }?>
				</strong> <br>
				<?php if($profile['details']->city){?>
				<?= $this->location_model->get_city_data($profile['details']->city)->cityname;?>
				<?php }?>
				,
				<?php if($profile['details']->state){?>
				<?= $this->location_model->get_region_data($profile['details']->state)->statename;?>
				<?php }?>
				<?php if($profile['details']->zip){?>
				<?= $profile['details']->zip;?>
				<?php }?>
				<br> <abbr title="Phone">P:</abbr>
				<?php if($profile['details']->phone1){?>
				<?= $profile['details']->phone1;?>
				<?php }?>
				,
				<?php if($profile['details']->phone2){?>
				<?= $profile['details']->phone2;?>
				<?php }?>
				<!-- <br> <abbr title="Phone"><i class="glyphicon glyphicon-eye-open"></i>
				</abbr> (
				<?= $profile['details']->hits;?>
				) -->
			</address>
			<!-- <a href="#" data-toggle="modal" data-target="#myMap" class="text-danger">View Map </a> -->
		</div>

	</div>

	
</div>


<form class="row form-inline" role="form"
	name="post_enq_form" id="post_enq_form" method="POST">
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">



		<div class="modal-dialog">
			<div class="modal-content">

				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">
						Send email to
						<?= ucfirst(strtolower($profile['details']->title));?>
					</h4>
				</div>
				<div class="modal-body">
					<span class="pull-right text-danger" id="msz_alert"> </span>


					</p>
					<input type="hidden" name="emailID" id="emailID"
						value="<?php echo $profile['details']->email;?>">

					<div class="form-group">
						<label for="name">Your Name </label> <input type="name"
							class="form-control" id="enqname" name="enqname"
							placeholder="Enter your full name">
					</div>
					</p>
					<div class="form-group">
						<label for="email_address">Your Email </label> <input type="email"
							class="form-control" id="enqemail" name="enqemail"
							placeholder="Enter your Email">
					</div>

					</p>
					<div class="form-group">
						<label for="mail_description">Enter your mail ( Minimum 50
							character )</label>
						<textarea class="full-width text" cols="60" name="enqdescription"
							id="enqdescription" rows="5"></textarea>
					</div>

				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					<button type="button" class="btn btn-primary" id="btn_enq_submit">Save</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->

	</div>
	<!-- /.modal -->


</form>


<?php }?>